using System.ComponentModel.DataAnnotations;

namespace Admin2025.Application.Dtos;

/// <summary>
/// 文件上传结果
/// </summary>
public class FileUploadResultDto
{
    /// <summary>
    /// 文件ID
    /// </summary>
    public string FileId { get; set; } = string.Empty;
    /// <summary>
    /// 原始文件名
    /// </summary>
    public string OriginalFileName { get; set; } = string.Empty;
    /// <summary>
    /// 存储文件名
    /// </summary>
    public string StoredFIleName { get; set; } = string.Empty;
    /// <summary>
    /// 文件大小（字节）
    /// </summary>
    public long FileSize { get; set; }
    /// <summary>
    /// 文件扩展名
    /// </summary>
    public string Extension { get; set; } = string.Empty;
    /// <summary>
    /// MIME类型
    /// </summary>
    public string MimeType { get; set; } = string.Empty;
    /// <summary>
    /// 访问URL
    /// </summary>
    public string Url { get; set; } = string.Empty;
    /// <summary>
    /// 缩略图URL（如果有）
    /// </summary>
    public string? ThumbnailUrl { get; set; }
    /// <summary>
    /// 相对路径
    /// </summary>
    public string RelativePath { get; set; } = string.Empty;
    /// <summary>
    /// 上传时间
    /// </summary>
    public DateTime UploadTime { get; set; } = DateTime.UtcNow;
}

/// <summary>
/// 文件上传验证结果DTO
/// </summary>
public class FileValidationResultDto
{
    /// <summary>
    /// 是否验证通过
    /// </summary>
    public bool IsValid { get; set; }
    /// <summary>
    /// 错误信息列表
    /// </summary>
    public List<string> Errors { get; set; } = new();
    /// <summary>
    /// 文件信息
    /// </summary>
    public FileInfoDto? FileInfo { get; set; }
}

/// <summary>
/// 文件信息DTO
/// </summary>
public class FileInfoDto
{
    /// <summary>
    /// 文件名
    /// </summary>
    public string FileName { get; set; } = string.Empty;
    /// <summary>
    /// 文件大小
    /// </summary>
    public long FileSize { get; set; }
    /// <summary>
    /// 文件扩展名
    /// </summary>
    public string Extension { get; set; } = string.Empty;
    /// <summary>
    /// MIME类型
    /// </summary>
    public string MimeType { get; set; } = string.Empty;
}

/// <summary>
/// 批量上传结果DTO
/// </summary>
public class BatchUploadResultDto
{
    /// <summary>
    /// 成功上传的文件
    /// </summary>
    public List<FileUploadResultDto> SuccessFile { get; set; } = new();
    /// <summary>
    /// 失败文件及错误信息
    /// </summary>
    public List<FailedFileDto> FailedFiles { get; set; } = new();
    /// <summary>
    /// 总文件数
    /// </summary>
    public int TotalCount { get; set; }
    /// <summary>
    /// 成功数量
    /// </summary>
    public int SuccessCount { get; set; }
    /// <summary>
    /// 失败数量
    /// </summary>
    public int FailedCount { get; set; }
}
/// <summary>
/// 失败文件DTO
/// </summary>
public class FailedFileDto
{
    /// <summary>
    /// 文件名
    /// </summary>
    public string FileName { get; set; } = string.Empty;
    /// <summary>
    /// 错误信息
    /// </summary>
    public List<string> Errors { get; set; } = new();
}